package com.china.school;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;


/**
 消除web.xml文件
 */
public class WebApplicationInitializerTest extends
        AbstractAnnotationConfigDispatcherServletInitializer {
 //返回的带有@Configuration注解的类用来配置ContextLoaderListener
 protected Class<?>[] getRootConfigClasses() {
 System.out.println("加载核心配置类创建ContextLoaderListener");
 return new Class[]{}; //加载spring容器配置类
 }
 //返回的带有@Configuration注解的类用来配置DispatcherServlet
 protected Class<?>[] getServletConfigClasses() {
 System.out.println("加载核心配置类创建DispatcherServlet");
 return new Class[]{SpringConfig.class}; //加载springmvc容器配置类
 }
 //将一个或多个路径映射到DispatcherServlet上
 protected String[] getServletMappings() {
 return new String[]{"/"};
 }
}